package com.xiyu.service.controller.admin.setting;
import com.xiyu.service.vo.setting.businessField.BusinessFieldGetByModuleOutput;
import com.xiyu.service.vo.setting.businessField.BusinessFieldUpdateInput;
import com.xiyu.service.vo.setting.businessField.BusinessFieldSingleGetOutput;
import com.xiyu.service.vo.setting.businessField.BusinessFieldGetOptionByFieldIdOutput;
import com.xiyu.service.vo.setting.businessField.BusinessFieldListQueryOutput;
import com.xiyu.service.vo.setting.businessField.BusinessFieldListQueryInput;
import org.springframework.web.bind.annotation.*;
import jakarta.annotation.Resource;
import org.springframework.validation.annotation.Validated;
import io.swagger.v3.oas.annotations.tags.Tag;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.Operation;

import jakarta.validation.*;

import java.util.*;

import com.xiyu.service.framework.web.web.core.pojo.PageResult;
import com.xiyu.service.framework.web.web.core.pojo.CommonResult;
import static com.xiyu.service.framework.web.web.core.pojo.CommonResult.success;

import com.xiyu.service.framework.excel.core.util.ExcelUtils;

import com.xiyu.service.framework.operateLog.core.annotations.OperateLog;
import static com.xiyu.service.framework.operateLog.core.enums.OperateTypeEnum.*;

import com.xiyu.service.service.setting.BusinessFieldService;
//import com.xiyu.service.vo.setting.businessField.*;

@Tag(name = "业务字段")
@RestController
@RequestMapping("/setting/business-field")
@Validated
public class BusinessFieldController {

    @Resource
    private BusinessFieldService businessFieldService;

    @GetMapping("/list-query")
    @Operation(summary = "查询业务字段")
    public CommonResult<List<BusinessFieldListQueryOutput>> listQuery(@Valid BusinessFieldListQueryInput inputVO) {
        return success(businessFieldService.listQuery(inputVO));
    }

    @GetMapping("/get-option-by-field-id")
    @Operation(summary = "根据业务字段ID获取业务字段选项")
    @Parameter(name = "id", description = "业务字段主键ID", example = "")
    public CommonResult<List<BusinessFieldGetOptionByFieldIdOutput>> getOptionByFieldId(@RequestParam("id") Long id) {
        return success(businessFieldService.getOptionByFieldId(id));
    }

    @GetMapping("/single-get")
    @Operation(summary = "获取单个业务字段")
    @Parameter(name = "id", description = "业务字段主键ID", example = "")
    public CommonResult<BusinessFieldSingleGetOutput> singleGet(@RequestParam("id") Long id) {
        return success(businessFieldService.singleGet(id));
    }

    @PutMapping("/update")
    @Operation(summary = "更新业务字段")
    public CommonResult<Boolean> update(@Valid @RequestBody BusinessFieldUpdateInput inputVO) {
        return success(businessFieldService.update(inputVO));
    }

    @GetMapping("/get-by-module")
    @Operation(summary = "根据业务模块获取业务")
    @Parameter(name = "businessModule", description = "业务模块", example = "")
    public CommonResult<List<BusinessFieldGetByModuleOutput>> getByModule(@RequestParam("businessModule") Integer businessModule) {
        return success(businessFieldService.getByModule(businessModule));
    }

    @GetMapping("/get-work-state-resign-option-id")
    @Operation(summary = "获取工作状态离职的id")
    public CommonResult<Long> getWorkStateResignOptionId() {
        return success(businessFieldService.getWorkStateResignOptionId());
    }

}
